<script lang="jsx" setup>
import dayjs from 'dayjs';
import { computed, nextTick, ref } from 'vue';

const commonSearchRef = ref(null);
const tableRef = ref(null);
const searchParams = ref({
  moduleNo: null,
  lotId: null,
  pnlId: null,
  time: null,
  hasPnl: null
});

const searchFormList = [
  {
    type: 'input',
    key: 'moduleNo',
    label: '生产型号',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    placeholder: '请输入生产型号',
    showTime: true
  },
  {
    type: 'input',
    key: 'lotId',
    label: '批次号',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    placeholder: '请输入批次号',
    showTime: true
  },
  {
    type: 'select',
    key: 'hasPnl',
    label: '是否有码',
    placeholder: '请选择是否有码',
    span: 24,
    md: 12,
    lg: 8,
    xl: 8,
    xxl: 6,
    selectOptions: [
      {
        label: '有码',
        value: 1
      },
      {
        label: '无码',
        value: 2
      }
    ]
  },
  {
    type: 'input',
    key: 'pnlId',
    label: ' PNL码',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    placeholder: '请输入PNL码',
    showTime: true
  },
  {
    type: 'dateRangePicker',
    key: 'time',
    label: '日　　期',
    span: 24,
    md: 12,
    lg: 10,
    xl: 8,
    xxl: 6,
    showTime: true // 显示时分秒选择
  }
];

const searchData = computed(() => {
  const params = {
    ...searchParams.value
  };
  if (searchParams.value?.time?.[0]) {
    params.startTime = dayjs(searchParams.value.time[0]).format('YYYY-MM-DD HH:mm:ss');
    params.endTime = dayjs(searchParams.value.time[1]).format('YYYY-MM-DD HH:mm:ss');
  }
  delete params.time;
  return params;
});

// 表格数据
const column = [
  {
    key: 'dataIndex',
    dataIndex: 'dataIndex',
    title: '序号',
    fixed: 'left',
    width: 70,
    align: 'center',
    checked: true,
    ellipsis: true
  },

  {
    key: 'moduleNo',
    dataIndex: 'moduleNo',
    title: ' 生产型号',
    width: 160,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'lotId',
    dataIndex: 'lotId',
    title: ' 批次号',
    width: 140,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'pnlId',
    dataIndex: 'pnlId',
    title: ' PNL码',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'readCodeTime',
    dataIndex: 'readCodeTime',
    title: ' 进站时间',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },

  {
    key: 'mainEqpId',
    dataIndex: 'mainEqpId',
    title: '设备编号',
    align: 'center',
    width: 100,
    checked: true,
    ellipsis: true,
    fixed: 'left'
  },
  {
    key: 'itemName1',
    dataIndex: 'itemName1',
    width: 150,
    title: '开机时间累积 h',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName2',
    dataIndex: 'itemName2',
    width: 150,
    title: '运行时间累积 h',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName3',
    dataIndex: 'itemName3',
    width: 150,
    title: '批次产量累积 PNL',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName4',
    dataIndex: 'itemName4',
    width: 150,
    title: '总产量累积 PNL',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName5',
    dataIndex: 'itemName5',
    width: 150,
    title: '用电量累积 kW.h',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName6',
    dataIndex: 'itemName6',
    width: 150,
    title: '自来水用量积累 m3',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName7',
    dataIndex: 'itemName7',
    width: 150,
    title: '速度_实时值 m/min',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName8',
    dataIndex: 'itemName8',
    width: 150,
    title: '速度_设置值 m/min',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName9',
    dataIndex: 'itemName9',
    width: 150,
    title: '显影1温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName10',
    dataIndex: 'itemName10',
    width: 150,
    title: '显影2温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName11',
    dataIndex: 'itemName11',
    width: 150,
    title: '显影3温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName12',
    dataIndex: 'itemName12',
    width: 200,
    title: '新液洗温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName13',
    dataIndex: 'itemName13',
    width: 200,
    title: '加压水洗5温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName14',
    dataIndex: 'itemName14',
    width: 200,
    title: '加压水洗10温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName15',
    dataIndex: 'itemName15',
    width: 200,
    title: '加压水洗15温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName16',
    dataIndex: 'itemName16',
    width: 200,
    title: '热风吹干1温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName17',
    dataIndex: 'itemName17',
    width: 200,
    title: '热风吹干2温度_实时值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName18',
    dataIndex: 'itemName18',
    width: 150,
    title: '显影1温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName19',
    dataIndex: 'itemName19',
    width: 150,
    title: '显影2温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName20',
    dataIndex: 'itemName20',
    width: 150,
    title: '显影3温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName21',
    dataIndex: 'itemName21',
    width: 170,
    title: '新液洗温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName22',
    dataIndex: 'itemName22',
    width: 200,
    title: '加压水洗5温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName23',
    dataIndex: 'itemName23',
    width: 200,
    title: '加压水洗10温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName24',
    dataIndex: 'itemName24',
    width: 200,
    title: '加压水洗15温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName25',
    dataIndex: 'itemName25',
    width: 200,
    title: '热风吹干1温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName26',
    dataIndex: 'itemName26',
    width: 200,
    title: '热风吹干2温度_设置值 ℃',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName27',
    dataIndex: 'itemName27',
    width: 220,
    title: '显影1过滤泵A频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName28',
    dataIndex: 'itemName28',
    width: 200,
    title: '显影1过滤泵B频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName29',
    dataIndex: 'itemName29',
    width: 220,
    title: '显影2过滤泵A频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName30',
    dataIndex: 'itemName30',
    width: 200,
    title: '显影2过滤泵B频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName31',
    dataIndex: 'itemName31',
    width: 220,
    title: '显影3过滤泵A频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName32',
    dataIndex: 'itemName32',
    width: 200,
    title: '显影3过滤泵B频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName33',
    dataIndex: 'itemName33',
    width: 170,
    title: '新液洗频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName34',
    dataIndex: 'itemName34',
    width: 200,
    title: '加压水洗1频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName35',
    dataIndex: 'itemName35',
    width: 200,
    title: '加压水洗2频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName36',
    dataIndex: 'itemName36',
    width: 200,
    title: '加压水洗3频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName37',
    dataIndex: 'itemName37',
    width: 200,
    title: '加压水洗4频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName38',
    dataIndex: 'itemName38',
    width: 200,
    title: '加压水洗5频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName39',
    dataIndex: 'itemName39',
    width: 200,
    title: '加压水洗6频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName40',
    dataIndex: 'itemName40',
    width: 200,
    title: '加压水洗7频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName41',
    dataIndex: 'itemName41',
    width: 200,
    title: '加压水洗8频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName42',
    dataIndex: 'itemName42',
    width: 200,
    title: '加压水洗9频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName43',
    dataIndex: 'itemName43',
    width: 220,
    title: '加压水洗10频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName44',
    dataIndex: 'itemName44',
    width: 170,
    title: '酸洗A频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName45',
    dataIndex: 'itemName45',
    width: 170,
    title: '酸洗B频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName46',
    dataIndex: 'itemName46',
    width: 220,
    title: '加压水洗11频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName47',
    dataIndex: 'itemName47',
    width: 200,
    title: '加压水洗12频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName48',
    dataIndex: 'itemName48',
    width: 220,
    title: '加压水洗13频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName49',
    dataIndex: 'itemName49',
    width: 220,
    title: '加压水洗14频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName50',
    dataIndex: 'itemName50',
    width: 220,
    title: '加压水洗15频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName51',
    dataIndex: 'itemName51',
    width: 220,
    title: '强风吹干频率_实时值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName52',
    dataIndex: 'itemName52',
    width: 220,
    title: '显影1过滤泵A频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName53',
    dataIndex: 'itemName53',
    width: 220,
    title: '显影1过滤泵B频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName54',
    dataIndex: 'itemName54',
    width: 220,
    title: '显影2过滤泵A频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName55',
    dataIndex: 'itemName55',
    width: 220,
    title: '显影2过滤泵B频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName56',
    dataIndex: 'itemName56',
    width: 220,
    title: '显影3过滤泵A频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName57',
    dataIndex: 'itemName57',
    width: 220,
    title: '显影3过滤泵B频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName58',
    dataIndex: 'itemName58',
    width: 170,
    title: '新液洗频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName59',
    dataIndex: 'itemName59',
    width: 200,
    title: '加压水洗1频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName60',
    dataIndex: 'itemName60',
    width: 220,
    title: '加压水洗2频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName61',
    dataIndex: 'itemName61',
    width: 220,
    title: '加压水洗3频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName62',
    dataIndex: 'itemName62',
    width: 200,
    title: '加压水洗4频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName63',
    dataIndex: 'itemName63',
    width: 220,
    title: '加压水洗5频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName64',
    dataIndex: 'itemName64',
    width: 200,
    title: '加压水洗6频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName65',
    dataIndex: 'itemName65',
    width: 220,
    title: '加压水洗7频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName66',
    dataIndex: 'itemName66',
    width: 220,
    title: '加压水洗8频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName67',
    dataIndex: 'itemName67',
    width: 220,
    title: '加压水洗9频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName68',
    dataIndex: 'itemName68',
    width: 220,
    title: '加压水洗10频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName69',
    dataIndex: 'itemName69',
    width: 170,
    title: '酸洗A频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName70',
    dataIndex: 'itemName70',
    width: 170,
    title: '酸洗B频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName71',
    dataIndex: 'itemName71',
    width: 220,
    title: '加压水洗11频率_设置值 Hz',
    align: 'center',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName72',
    dataIndex: 'itemName72',
    width: 220,
    title: '加压水洗12频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName73',
    dataIndex: 'itemName73',
    width: 220,
    title: '加压水洗13频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName74',
    dataIndex: 'itemName74',
    width: 220,
    title: '加压水洗14频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName75',
    dataIndex: 'itemName75',
    width: 220,
    title: '加压水洗15频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName76',
    dataIndex: 'itemName76',
    width: 200,
    title: '强风吹干频率_设置值 Hz',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName77',
    dataIndex: 'itemName77',
    width: 220,
    title: '显影1A喷淋压力_实时值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName78',
    dataIndex: 'itemName78',
    width: 220,
    title: '显影1B喷淋压力_实时值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName79',
    dataIndex: 'itemName79',
    width: 220,
    title: '显影2A喷淋压力_实时值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName80',
    dataIndex: 'itemName80',
    width: 220,
    title: '显影2B喷淋压力_实时值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName81',
    dataIndex: 'itemName81',
    width: 220,
    title: '显影3A喷淋压力_实时值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName82',
    dataIndex: 'itemName82',
    width: 220,
    title: '显影3B喷淋压力_实时值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName83',
    dataIndex: 'itemName83',
    width: 220,
    title: '显影1A喷淋压力_设置值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName84',
    dataIndex: 'itemName84',
    width: 220,
    title: '显影1B喷淋压力_设置值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName85',
    dataIndex: 'itemName85',
    width: 220,
    title: '显影2A喷淋压力_设置值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName86',
    dataIndex: 'itemName86',
    width: 220,
    title: '显影2B喷淋压力_设置值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName87',
    dataIndex: 'itemName87',
    width: 220,
    title: '显影3A喷淋压力_设置值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName88',
    dataIndex: 'itemName88',
    width: 220,
    title: '显影3B喷淋压力_设置值 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName89',
    dataIndex: 'itemName89',
    width: 170,
    title: '新液洗上喷压力 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName90',
    dataIndex: 'itemName90',
    width: 170,
    title: '新液洗下喷压力 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName91',
    dataIndex: 'itemName91',
    width: 170,
    title: '强风吹干表1压力 kPa',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName92',
    dataIndex: 'itemName92',
    width: 170,
    title: '强风吹干表2压力 kPa',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName93',
    dataIndex: 'itemName93',
    width: 170,
    title: '强风吹干表3压力 kPa',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName94',
    dataIndex: 'itemName94',
    width: 170,
    title: '酸洗A上喷压力 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName95',
    dataIndex: 'itemName95',
    width: 170,
    title: '酸洗A下喷压力 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName96',
    dataIndex: 'itemName96',
    width: 170,
    title: '酸洗B上喷压力 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'itemName97',
    dataIndex: 'itemName97',
    width: 170,
    title: '酸洗B下喷压力 kg/cm²',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'dateTime',
    dataIndex: 'dateTime',
    title: '创建时间',
    width: 150,
    align: 'center',
    checked: true,
    ellipsis: true
  }
];

function search() {
  tableRef.value.getData(1);
}

function reset() {
  nextTick(() => {
    searchParams.value = {
      time: null,
      hasPnl: null
    };
    search();
  });
}
</script>

<template>
  <div
    class="code-whitelist-page jl-main-page min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto"
  >
    <CommonSearch
      ref="commonSearchRef"
      v-model:searchParams="searchParams"
      :form-list="searchFormList"
      :is-search="true"
      @search="search"
      @reset="reset"
    ></CommonSearch>

    <Table
      ref="tableRef"
      v-model:searchParams="searchData"
      :column="column"
      :show-row-selection="false"
      :auto-generate-uuid="true"
      :scroll="{ y: 'auto' }"
      is-init-get-data
      url="eap/EapEqpTrace2/selectYuZhouSolderShadow4"
    ></Table>
  </div>
</template>

<style lang="scss" scoped></style>
